/*
Work in this file belongs to PASSENGER MANAGEMENT group. 
Other groups are not allowed to make changes on this file. 

During development, you can use your own test code that
includes your own setup() and loop() functions but they 
should not be included when you are submitting your changes. 
*/

// passenger gets on the vehicle
void pmPassengerGetIn(int passengerId, byte departureStation, byte destinationStation)
{
  int i;
  
  for(i = 0; i < PASSENGERCAPACITY; i++)
  {
    //looking for an empty spot to seat the passenger
    if(pmPassengerList[i].id == 0)
    {
      pmPassengerList[i].id = passengerId;
      pmPassengerList[i].depStation = departureStation;
      pmPassengerList[i].desStation = destinationStation;
      pmPassengerCount++;
      break;      
    }
  }

}

void pmPassengerGetOut(byte currentStation)
{
  int i;
  
  for(i = 0; i < PASSENGERCAPACITY; i++)
  {
    //checking for passengers that will disembark at current station 
    if(pmPassengerList[i].desStation == currentStation)
    {
      pmPassengerList[i].id = 0;
      pmPassengerList[i].depStation = 0;
      pmPassengerList[i].desStation = 0;
      pmPassengerCount--;
    }
  }

}
